<!DOCTYPE HTML>
<html>

<head>
    <title>
        退货原因维护</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../../assets/css/dpl-min.css" rel="stylesheet" type="text/css"/>
    <link href="../../../assets/css/bui-min.css" rel="stylesheet" type="text/css" />
    <link href="../../../assets/css/page-min.css" rel="stylesheet" type="text/css" />
    <link href="../../../assets/css/jx-style.css" rel="stylesheet" type="text/css"/>
    <link href="../../../assets/css/prettify.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <div class="container">
        <div class="detail-page">
            <div class="span24">
                <h3>
退货原因维护<button type="button" id="add-size-info-btn" class="pull-right button button-default">添加退货原因</button></h3>
                <hr>
            </div>
            <div class="detail-section">
                <div class=" detail-row">
                    <div class="span24">
                        <!-- 表格 start-->
                        <div id="grid"></div>
                        <!-- 表格 end-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 初始隐藏 dialog内容 -->
    <div id="content" class="hide">
        <form class="form-horizontal">
            <div class="row">
                <div class="control-group span12">
                    <label class="control-label">
                        <s>*</s>订单状态：</label>
                    <div class="controls">
                        <select name="c" id="">
                            <option value="">==请选择订单状态==</option>
                            <option value="1">待发货</option>
                            <option value="2">已发货</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="control-group span12">
                    <label class="control-label">
                        <s>*</s>
                        退后原因：</label>
                    <div class="controls">
                        <input type="text" data-rules="{required : true}" class="control-text" name="b">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="control-group span12">
                    <label class="control-label">
                        <s>*</s> 序号：</label>
                    <div class="controls">
                        <input type="text" data-rules="{required : true,number:true}" class="control-text" name="a">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="../../../assets/js/jquery-1.8.1.min.js"></script>
    <script type="text/javascript" src="../../../assets/js/bui-min.js"></script>
    <script type="text/javascript" src="../../../assets/js/config-min.js"></script>
    <script type="text/javascript">
    BUI.use('common/page');
    </script>
    <!-- script start -->
    <script type="text/javascript">
    BUI.use(['bui/grid', 'bui/data'], function(Grid, Data) {
        var Grid = Grid,
             enumObj = {
                "1": "待发货",
                "2": "已发货"
            },
            Store = Data.Store,
            columns = [{
                title: '序号',
                dataIndex: 'a',
                elCls: 'center', //居中
                width: 200,
            }, {
                title: '原因 ',
                elCls: 'center',
                dataIndex: 'b',
                width: 200
            }, {
                title: '订单状态 ',
                elCls: 'center',
                dataIndex: 'c',
                width: 200,
                 renderer: Grid.Format.enumRenderer(enumObj)
            }, {
                title: '操作',
                dataIndex: 'f',
                elCls: 'center',
                width: 200,
                renderer: function(value, obj) {
                    return '<span class="grid-command btn-edit"><i class="icon icon-edit"></i>[ 修改 ]</span>'
                }
            }],
            data = [{
                a: '01',
                b: '缺货',
                c:'1'
            },{
                a: '01',
                b: '缺货',
                c:'2'
            } ];
        //初始化数据
        var isAddRemote = false,
            editing = new Grid.Plugins.DialogEditing({
                contentId: 'content', //设置隐藏的Dialog内容
                triggerCls: 'btn-edit', //触发显示Dialog的样式
                editor: {
                    title: '添加退货原因'
                }
            }),
            store = new Store({ //初始化数据
                data: data,
                autoLoad: true, //自动加载数据
                pageSize: 2 // 配置分页数目
            }),
            grid = new Grid.Grid({
                render: '#grid',
                elCls: 'small-bui-grid-table',
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                forceFit: true,
                // 底部工具栏
                bbar: {
                    // pagingBar:表明包含分页栏
                    pagingBar: true
                },
                plugins: [editing], //插件
                store: store
            });

        grid.render();
        //点击操作
        grid.on('itemclick', function(ev) {
            var sender = $(ev.domTarget),
                itemEl = $(ev.element),
                item = ev.item;

            if (sender.hasClass('btn-del')) { //点击删除操作
                delFunction(item, itemEl);

            } else if (sender.hasClass('btn-add')) { //点击编辑操作
                addFunction(item, itemEl);
            }

        });
        //点击添加按钮
        $("#add-size-info-btn").click(function() {
            addFunction();
        });
        //添加记录
        function addFunction() {
            var newData = {};
            editing.add(newData, 'a'); //添加记录后，直接编辑
        }
        
    });
    </script>
    <!-- script end -->

    <body>

</html>
